<?php
/**
 * Core_Data_Accesslevel
 * get access level
 * @author Adrian Stolarski
 */
class Core_Data_Accesslevel implements Core_Data_Mainable {
    
    /**
     *
     * @var type $database
     * database handler
     */
    public $database;
    
    /**
     * constructor()
     */
    public function __construct() {
        $this->database = new Core_Driver_MysqlImproved;
    }
    
    /**
     * main()
     * get access level
     * @param array $variables
     * @return type $access_level_data['access_level_type']
     */
    public function main(array $variables = null) {
        $this->database->connect();
        foreach($_SESSION as $key => $value){
            $_SESSION[$key] = $this->database->escape($value);
        }
        $this->database->prepare("SELECT access_level.access_level_type FROM access_level WHERE id=".$_SESSION['acces_leval_id']." LIMIT 1;");
        $this->database->query();
        $access_level_data = $this->database->fetch('array');
        return $access_level_data['access_level_type'];
    }

}
